/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.trick.admin.binding;

import it.trick.admin.task.AddCategoryTask;
import it.trick.admin.task.AddChapterTask;
import it.trick.admin.task.AddPageTask;
import it.trick.admin.task.AddPreTask;
import it.trick.admin.task.ChangeChapterNameTask;
import it.trick.admin.task.ChangeContentsIndexTask;
import it.trick.admin.task.ChangePageNameTask;
import it.trick.admin.task.DeleteCategoryTask;
import it.trick.admin.task.DeleteChapterTask;
import it.trick.admin.task.DeletePageTask;
import it.trick.admin.task.DeletePreTask;
import it.trick.admin.task.GetChapterModelTask;
import it.trick.admin.task.GetPageModelTask;
import it.trick.admin.task.LoadCategoryTreeTask;
import it.trick.admin.task.LoadPageListTask;
import it.trick.admin.task.LoadPreListTask;
import it.trick.admin.task.PublicChapterTask;
import it.trick.admin.task.PublicPageTask;
import it.trick.admin.task.PublicPreTask;
import it.trick.admin.task.UpdateCategoryTask;
import it.trick.admin.task.UpdateChapterTask;
import it.trick.admin.task.UpdatePageTask;
import javafx.beans.binding.BooleanBinding;

/**
 *
 * @author takahara
 */
public class ChannelManageProgressBinding extends BooleanBinding {

    private LoadCategoryTreeTask loadCategoryTreeTask;
    private LoadPageListTask loadPageListTask;
    private LoadPreListTask loadPreListTask;
    private ChangeContentsIndexTask changeIndexTask;
    private AddCategoryTask addCategoryTask;
    private AddChapterTask addChapterTask;
    private AddPageTask addPageTask;
    private AddPreTask addPreTask;
    private DeleteCategoryTask deleteCategoryTask;
    private DeleteChapterTask deleteChapterTask;
    private DeletePageTask deletePageTask;
    private DeletePreTask deletePreTask;
    private UpdateCategoryTask updateCategoryTask;
    private UpdateChapterTask updateChapterTask;
    private UpdatePageTask updatePageTask;
    private GetChapterModelTask getChapterModelTask;
    private GetPageModelTask getPageModelTask;
    private PublicChapterTask publicChapterTask;
    private PublicPageTask publicPageTask;
    private PublicPreTask publicPreTask;
    private ChangeChapterNameTask changeChapterNameTask;
    private ChangePageNameTask changePageNameTask;

    /**
     * コンストラクタ
     */
    public ChannelManageProgressBinding(
            LoadCategoryTreeTask loadCategoryTreeTask,
            LoadPageListTask loadPageListTask,
            LoadPreListTask loadPreListTask,
            ChangeContentsIndexTask changeIndexTask,
            AddCategoryTask addCategoryTask,
            AddChapterTask addChapterTask,
            AddPageTask addPageTask,
            AddPreTask addPreTask,
            DeleteCategoryTask deleteCategoryTask,
            DeleteChapterTask deleteChapterTask,
            DeletePageTask deletePageTask,
            DeletePreTask deletePreTask,
            UpdateCategoryTask updateCategoryTask,
            UpdateChapterTask updateChapterTask,
            UpdatePageTask updatePageTask,
            GetChapterModelTask getChapterModelTask,
            GetPageModelTask getPageModelTask,
            PublicChapterTask publicChapterTask,
            PublicPageTask publicPageTask,
            PublicPreTask publicPreTask,
            ChangeChapterNameTask changeChapterNameTask,
            ChangePageNameTask changePageNameTask) {
        this.loadCategoryTreeTask = loadCategoryTreeTask;
        this.loadPageListTask = loadPageListTask;
        this.loadPreListTask = loadPreListTask;
        this.changeIndexTask = changeIndexTask;
        this.addCategoryTask = addCategoryTask;
        this.addChapterTask = addChapterTask;
        this.addPageTask = addPageTask;
        this.addPreTask = addPreTask;
        this.deleteCategoryTask = deleteCategoryTask;
        this.deleteChapterTask = deleteChapterTask;
        this.deletePageTask = deletePageTask;
        this.deletePreTask = deletePreTask;
        this.updateCategoryTask = updateCategoryTask;
        this.updateChapterTask = updateChapterTask;
        this.updatePageTask = updatePageTask;
        this.getChapterModelTask = getChapterModelTask;
        this.getPageModelTask = getPageModelTask;
        this.publicChapterTask = publicChapterTask;
        this.publicPageTask = publicPageTask;
        this.publicPreTask = publicPreTask;
        this.changeChapterNameTask = changeChapterNameTask;
        this.changePageNameTask = changePageNameTask;

        super.bind(loadCategoryTreeTask.runningProperty());
        super.bind(loadPageListTask.runningProperty());
        super.bind(loadPreListTask.runningProperty());
        super.bind(changeIndexTask.runningProperty());
        super.bind(addCategoryTask.runningProperty());
        super.bind(addChapterTask.runningProperty());
        super.bind(addPageTask.runningProperty());
        super.bind(addPreTask.runningProperty());
        super.bind(deleteCategoryTask.runningProperty());
        super.bind(deleteChapterTask.runningProperty());
        super.bind(deletePageTask.runningProperty());
        super.bind(deletePreTask.runningProperty());
        super.bind(updateCategoryTask.runningProperty());
        super.bind(updateChapterTask.runningProperty());
        super.bind(updatePageTask.runningProperty());
        super.bind(getChapterModelTask.runningProperty());
        super.bind(getPageModelTask.runningProperty());
        super.bind(publicChapterTask.runningProperty());
        super.bind(publicPageTask.runningProperty());
        super.bind(publicPreTask.runningProperty());
        super.bind(changeChapterNameTask.runningProperty());
        super.bind(changePageNameTask.runningProperty());
    }

    @Override
    protected boolean computeValue() {

        if (loadCategoryTreeTask.runningProperty().getValue()) {
            return true;
        }
        if (loadPageListTask.runningProperty().getValue()) {
            return true;
        }
        if (loadPreListTask.runningProperty().getValue()) {
            return true;
        }
        if (changeIndexTask.runningProperty().getValue()) {
            return true;
        }

        if (addCategoryTask.runningProperty().getValue()) {
            return true;
        }
        if (addChapterTask.runningProperty().getValue()) {
            return true;
        }
        if (addPageTask.runningProperty().getValue()) {
            return true;
        }
        if (addPreTask.runningProperty().getValue()) {
            return true;
        }
        if (deleteCategoryTask.runningProperty().getValue()) {
            return true;
        }
        if (deleteChapterTask.runningProperty().getValue()) {
            return true;
        }
        if (deletePageTask.runningProperty().getValue()) {
            return true;
        }
        if (deletePreTask.runningProperty().getValue()) {
            return true;
        }
        if (updateCategoryTask.runningProperty().getValue()) {
            return true;
        }
        if (updateChapterTask.runningProperty().getValue()) {
            return true;
        }
        if (updatePageTask.runningProperty().getValue()) {
            return true;
        }
        if (getChapterModelTask.runningProperty().getValue()) {
            return true;
        }
        if (getPageModelTask.runningProperty().getValue()) {
            return true;
        }
        if (publicChapterTask.runningProperty().getValue()) {
            return true;
        }
        if (publicPageTask.runningProperty().getValue()) {
            return true;
        }
        if (publicPreTask.runningProperty().getValue()) {
            return true;
        }
        if (changeChapterNameTask.runningProperty().getValue()) {
            return true;
        }
        if (changePageNameTask.runningProperty().getValue()) {
            return true;
        }

        return false;
    }
}
